<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Appel de fonds - ATENET.</title>
<style>
table {
	font-size: 9pt;
	font-family: Arial, Helvetica, sans-serif;
}
.lots {
	border-right: 1px solid #000;
	border-bottom: 1px solid #000;
}
.lots td, table th {
	border-left: 1px solid #000;
	border-top: 1px solid #000;
}

.break { 
     page-break-before: always; 
}
</style>
</head>

<body style="width: 185mm;">

<table style="width: 185mm;" cellspacing="0" cellpadding="4">
	<tr valign="top">
		<td style="width: 100mm; border: 1px solid #000;" rowspan="4">
			Syndic:
			<h2>{{ immeuble.syndic.name }}<br />
			{{ immeuble.syndic.adress }}</h2><br />
			Tel: {{ immeuble.syndic.phone }}<br />
			Fax: {{ immeuble.syndic.fax }}<br /><br />
			Email: {{ immeuble.syndic.email }}<br />
			Site internet: {{ immeuble.syndic.wwwsite }}
		</td>
		<td style="width: 5mm;">
		</td>
		<td align="center" style="width: 85mm; border: 1px solid #000;">
			<h2>Appel de fonds</h2>
			
		</td>
	</tr>
	<tr valign="top">
		<td></td>
		<td style="border-left: 1px solid #000; border-right: 1px solid #000; border-bottom: 1px solid #000;">
			Copropriete:<br />
			{{ immeuble.name }}<br />
			{{ immeuble.adress }}
		</td>
	</tr>
	<tr valign="top">
		<td></td>
		<td style="height: 5mm;">
		</td>
	</tr>
	<tr valign="top">
		<td></td>
		<td style="border: 1px solid #000;">
		<b>Contrôler page.</b>	
		</td>
	</tr>
	<tr valign="top">
		<td align="left"><b>Date limite de paiement: {{ deadline|datetimeformat }}</b></td>
		<td></td>
		<td align="right"></td>
	</tr>
</table>
<br>
<table class='lots' style="width: 185mm;" cellspacing="0mm" cellpadding="4">
	<tr>
		<th>Exercise</th>
		<th>Budgeté Total</th>
		<th>Montant appelé</th>
		<th>Montant distribué<br>(calculé)</th>
	</tr>
	<tr>
		<td align="center">{{ period }}</td>
		<td align="center">{{ budget_sum|currencyformat }}</td>
		<td align="center">{{ fr_sum|currencyformat }}</td>
		<td align="center">{{ calc_sum|currencyformat }}</td>	
	</tr>
</table>
<br>
<table class='lots' style="width: 185mm;" cellspacing="0mm" cellpadding="4">
	<tr>
		<th>Clé</th>
		<th>Budgeté Total</th>
		<th>Tolal réel</th>
	</tr>
	{% for c in ck_merged|dictsort %}
	<tr>
		<td align="left">{{ c[0] }}</td>
		<td align="center">{{ c[1]['amount']|currencyformat }}</td>
		<td align="center">{% if c[1]['sum'] %}{{ c[1]['sum'] }}{% else %}
		<font color="red">Non défini</font>
		{% endif %}
		</td>
	</tr>
	{% endfor %}
</table>
<br><br>

<div class="break"></div>
{% for p in pages %}

<table style="width: 185mm;" cellspacing="0" cellpadding="4">
	<tr valign="top">
		<td style="width: 100mm; border: 1px solid #000;" rowspan="4">
			Syndic:
			<h2>{{ immeuble.syndic.name }}<br />
			{{ immeuble.syndic.adress }}</h2><br />
			Tel: {{ immeuble.syndic.phone }}<br />
			Fax: {{ immeuble.syndic.fax }}<br /><br />
			Email: {{ immeuble.syndic.email }}<br />
			Site internet: {{ immeuble.syndic.wwwsite }}
		</td>
		<td style="width: 5mm;">
		</td>
		<td align="center" style="width: 85mm; border: 1px solid #000;">
			<h2>Appel de fonds</h2>
			
		</td>
	</tr>
	<tr valign="top">
		<td></td>
		<td style="border-left: 1px solid #000; border-right: 1px solid #000; border-bottom: 1px solid #000;">
			Copropriete:<br />
			{{ immeuble.name }}<br />
			{{ immeuble.adress }}
		</td>
	</tr>
	<tr valign="top">
		<td></td>
		<td style="height: 5mm;">
		</td>
	</tr>
	<tr valign="top">
		<td></td>
		<td style="border: 1px solid #000;">
			Destinataire:<br />
			{{ p['owner'] }}<br/>
			{{ p['owner'].address }}
		</td>
	</tr>
	<tr valign="top">
		<td align="left"><b>Date limite de paiement: {{ deadline|datetimeformat }}</b></td>
		<td></td>
		<td align="right"></td>
	</tr>
</table>

{% for l in p['lots'] %}
<table class="lots" style="width: 185mm;" cellspacing="0mm" cellpadding="1.5mm">
	<tr>
		<th width="65mm">Nature de l’appel</th>
		<th width="10mm">Lot</th>
		<th width="40mm">Montant à répartir</th>
		<th width="20mm">Millième</th>
		<th width="20mm">Tantième</th>
		<th width="40mm">Votre quote-part</th>
	</tr>
	{% for ck in l['charges_keys'] %}
	<tr style="background-color: #CCC;">
		<td><b>{{ ck['charges_key'] }}</b></td>
		<td align="center"><b>{{ l['lot'].number }}</b></td>
		<td align="right"><b>{{ ck['budget_ck_amount']|currencyformat }}</b></td>
		<td align="right"><b>{{ ck['millieme'] }}</b></td>
		<td align="right"><b>{{ ck['tantieme'] }}</b></td>
		<td align="right"><b>{{ ck['ck_amount']|currencyformat }}</b></td>
	</tr>
	{% for e in ck['expenditures'] %}
	<tr style="font-size: 7pt;">
		<td valign="top">&nbsp;&nbsp;{{ e['expenditure'].code }} {{ e['expenditure'].title }}</td>
		<td valign="top"></td>
		<td valign="top" align="right">{{ e['budget_amount']|currencyformat }}</td>
		<td valign="top" colspan='2' ></td>
		<td valign="top" align="right">{{ e['amount']|currencyformat }}</td>
	</tr>
	{% endfor %}
	{% endfor %}
</table>
</br>
<table style="width: 185mm;" cellspacing="0" cellpadding="4">
	<tr valign="top">
		<td style="width: 65mm; border: 0px;" rowspan="3"></td>
	</tr>
	<tr valign="top">
		<td width="10mm" align="center" style="background-color: #CCC; border-right: 1px solid #000; border-top: 1px solid #000; border-left:  1px solid #000;" ><b><nobr>Lot</nobr></b></td>
		<td width="40mm" align="center" style="background-color: #CCC; border-right: 1px solid #000; border-top: 1px solid #000;" ><b><nobr>Total quote-part</nobr></b></td>
		<td width="40mm" align="center" style="background-color: #CCC; border-right: 1px solid #000; border-top: 1px solid #000;" ><b><nobr>Total à payer</nobr></b></td>
	</tr>
	<tr valign="top">
		<td align="center" style="border: 1px solid #000;">{{ l['lot'].number }}</td>
		<td align="center" style="border-right: 1px solid #000; border-bottom: 1px solid #000; border-top: 1px solid #000;">{{ l['lot_sum']|currencyformat }}</td>
		<td align="center" style="border-right: 1px solid #000; border-bottom: 1px solid #000; border-top: 1px solid #000;">{{ l['lot_sum']|currencyformat }}</td>
	</tr>
</table>
<br>
{% endfor %}
<table style="width: 185mm;" cellspacing="0" cellpadding="4">
	<tr valign="top">
		<td style="width: 75mm; border: 0px;" rowspan="3" align="right" valign="bottom"><h3>Grand total:&nbsp;&nbsp;</h3></td>
	</tr>
	<tr valign="top">
		<td width="40mm" align="center" style="background-color: #CCC; border-right: 1px solid #000; border-top: 1px solid #000; border-left:  1px solid #000;" ><b><nobr>Total appel</nobr></b></td>
		<td width="40mm" align="center" style="background-color: #CCC; border-right: 1px solid #000; border-top: 1px solid #000;" ><b><nobr>Total quote-part</nobr></b></td>
		<td width="40mm" align="center" style="background-color: #CCC; border-right: 1px solid #000; border-top: 1px solid #000;" ><b><nobr>Total à payer</nobr></b></td>
	</tr>
	<tr valign="top">
		<td align="center" style="border: 1px solid #000;">{{  fr_sum|currencyformat }}</td>
		<td align="center" style="border-right: 1px solid #000; border-bottom: 1px solid #000; border-top: 1px solid #000;">{{  p['lots']|sum(attribute='lot_sum')|currencyformat }}</td>
		<td align="center" style="border-right: 1px solid #000; border-bottom: 1px solid #000; border-top: 1px solid #000;">{{  p['lots']|sum(attribute='lot_sum')|currencyformat }}</td>
	</tr>
</table>
<br><br>
<table style="width: 100mm; page-break-inside: avoid;" cellspacing="0" cellpadding="8">
	<tr class="lots">
		<td style="width: 100mm; border: 1px solid #000;" align="center">
		Observation :<br><br>
		{{ description }}
		</td>
	</tr>
	<tr valign="top">
		<td width="100mm" align="center" style="border: 0px;" >&nbsp;</td>
	</tr>
	<tr valign="top">
		<td align="center" style="border: 1px dotted #000;">
		<p>Talon à détacher et à joindre à votre chèque</p>
		<font style="font-size: 12pt;">Montant à payer  {{  p['lots']|sum(attribute='lot_sum')|currencyformat }}</font><br>
		<font style="font-size: 5pt;">
		Règlement  par chèque à l’ordre de : {{ immeuble.name }} <br>
		Copropriétaire : {{ p['owner'] }} {{ p['owner'].address }}
		</font>
		</td>
	</tr>
</table>
<br>
<br>
<div class="break"></div>
{% endfor %}
</body>
</html>